package com.lzp.androidprojects.simple1.presenter;


import com.lzp.androidprojects.simple1.model.Main2Model;
import com.lzp.androidprojects.simple1.model.MainModel;
import com.lzp.androidprojects.simple1.model.MvpModel;
import com.lzp.androidprojects.simple1.view.MvpView;

import java.util.List;

/**
 * Created by Administrator on 2019/6/1.
 */
public class MainPresenter extends BasePresenter<MvpView> {
    private MvpModel mvpModel;
    private MvpView mvpView;
    public MainPresenter(){
        mvpModel = new MainModel();
    }
//    public MainPresenter(MvpView mvpview){
//        this.mvpView =mvpview;
//        mainModel = new MainModel();
//    }

    public MainPresenter setMvpModel(MvpModel mvpModel){
        this.mvpModel = mvpModel;
        return this;
    }
    public MainPresenter setMvpModel(int model){
        switch (model){
            case 0:
                mvpModel = new MainModel();
                break;
            case 1:
                mvpModel = new Main2Model();
                break;
        }
        return this;
    }

    public void getData(){
        mvpModel.getData(new MvpModel.OnLoadComplete() {
            @Override
            public void onLoadComplete(List<String> list) {
                getView().showData(list);
            }
        });
    }
}
